public class Test {
    public static void main(String[] args) {
        MyArray<Integer> myArray1 = new MyArray<>();
        myArray1.setArray(0, 19);
        myArray1.setArray(1, 29);

        Integer val1 = myArray1.getVal(1);
        System.out.println(val1);


        MyArray<String> myArray2 = new MyArray<>();
        myArray2.setArray(0, "Hello");
        myArray2.setArray(1, "World");

        String val2 = myArray2.getVal(1);
        System.out.println(val2);
    }
}

class MyArray<T> {
    public Object[] array = new Object[3];

    public void setArray(int pos, T val) {
        array[pos] = val;
    }

    public T getVal(int pos) {
        return (T)array[pos];
    }
}
